package com.qingyun.video.controller;



import com.qingyun.model.common.dtos.R;
import com.qingyun.model.video.pojos.Video;
import com.qingyun.model.video.pojos.VideoChannel;
import com.qingyun.video.service.VideoService;
import com.qingyun.video.service.LikeService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;
@Slf4j
@RestController
@RequestMapping("/video")
public class VideoController {

    @Resource
    private VideoService videoService;
    @Resource
    private com.qingyun.video.mapper.VideoMapper VideoMapper;




    @Resource
    private LikeService likeService;


    @GetMapping("delete")
    public R deleteVideoById(Long id){
        videoService.removeById(id);
        return R.success("删除成功");
    }

    @GetMapping("/selectMyVideo")
    public R<List<Video>> selectMyVideo() {
        return videoService.selectMyVideo();
    }

    @GetMapping("/selectMyVideoToBeReviewed")
    public R<List<Video>> selectMyVideoToBeReviewed() {
        return videoService.selectMyVideoToBeReviewed();
    }

    @GetMapping("/selectMyVideoByAudited")
    public R<List<Video>> selectMyVideoByAudited() {
        return videoService.selectMyVideoByAudited();
    }

    @GetMapping("/selectMyVideoByUnPublish")
    public R<List<Video>> selectMyVideoByUnPublish() {
        return videoService.selectMyVideoByUnPublish();
    }

    @GetMapping("/selectMyVideoByReleased")
    public R<List<Video>> selectMyVideoByReleased() {
        return videoService.selectMyVideoByReleased();
    }
    /**
     * 全部查询：进入界面自动加载
     */


    @GetMapping("/selectAllVideo")
    public R<List<Video>> selectAllVideo() {
        return videoService.selectAllVideo();
    }

    /**
     * 按文章频道查询
     */

    @GetMapping("/selectVideoByChannel/{id}")
    public R<List<Video>> selectVideoByChannel(@PathVariable Long id) {
        return videoService.selectVideoByChannel(id);
    }



    @GetMapping("/channel/list")
    public R<List<VideoChannel>> ListChannel(){
       return videoService.selectChannel();
    }
}
